{extend name="common/base"}
{block name="content"}
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>{$title|default='后台管理'}</legend>
</fieldset>
<table class="layui-table">
    <colgroup>
        <col width="150">
        <col width="200">
        <col>
    </colgroup>
    <thead>
    <tr>
        <th>备份名称</th>
        <th>卷数</th>
        <th>大小</th>
        <th>压缩</th>
        <th>日期</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    {foreach $dblist as $k=>$v}
    <tr>
        <td>{$k}</td>
        <td>{$v.part}</td>
        <td>{$v.size}</td>
        <td>{$v.compress}</td>
        <td>{$v.time}</td>
        <td>
            <div class="layui-btn-group">
                <a class="layui-btn" href="{:url('admin/database/restore',['id'=>$v.time])}">还原</a>
                <button class="layui-btn" onclick="backdel('{$v.time}')">删除</button>
            </div>
        </td>
    </tr>
    {/foreach}
    </tbody>
</table>
{/block}
{block name="extend_js"}
<script>
    layui.use(['layer','table'],function(){
        var layer=layui.layer
            ,form=layui.form;
    });

    /**
     *数据库备份删除
     */
    function backdel(data) {
        $.ajax({
            url:"{:url('admin/database/back_del')}",
            type:"post",
            dataType:"json",
            data:{'time':data}
        })
        .done(function(data){
            alert(data.msg);
            window.location.reload(true);
        })
        .fail(function(){
            alert('error');
        });
    }
</script>
{/block}
